function mergeMultipleTrees(...trees) {
    if (trees.length === 0) return {};
    let mergedTree = { ...trees[0] };
    for (let i = 1; i < trees.length; i++) {
        mergedTree = mergeTrees(mergedTree, trees[i]);
    }
    return mergedTree;
}
function mergeTrees(tree1, tree2) {
    let mergedTree = { ...tree1 };
    mergedTree.children = mergeNodes(tree1.children || [], tree2.children || []);
    return mergedTree;
}

function mergeNodes(nodes1, nodes2) {
    let mergedNodes = [...nodes1];
    // 遍历第二棵树的节点
    nodes2.forEach(node2 => {
        if (node2.title === '综合部') return;
        // 查找是否有相同id的节点在第一棵树中
        let existingNode = mergedNodes.find(node1 => node1.id === node2.id);
        if (existingNode) {
            existingNode.children = mergeNodes(existingNode.children || [], node2.children || []);
        } else {
            mergedNodes.push(node2);
        }
    });
    return mergedNodes;
}